<template>
<<<<<<< HEAD
  <div class="bg-[#fdc14b] h-[12.5rem] flex justify-center items-center">
    <div class="w-full flex justify-center items-center">
      <div class="w-1/3 flex justify-center items-center">
        <div class="">
          <img src="https://i.postimg.cc/T2cn3H1V/11-3x.png" alt="" />
        </div>
        <div
          class="flex flex-col justify-center items-center my-5 h-[5.6rem] text-white"
        >
          <h1
            class="text-base 2xl:text-3xl xl:text-2xl lg:text-xl md:text-lg sm:text-base"
          >
            来探索美食
          </h1>
          <p
            class="text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs mt-[1.4rem]"
          >
            品尝甜蜜，探索新意
          </p>
=======
  <div class="bg-[#fdc14b] h-[12.5rem] flex  justify-center  items-center">
    <div class="w-full   flex justify-center  items-center">
      <div class="w-1/3  flex justify-center  items-center">
        <div class=""><img src="https://i.postimg.cc/T2cn3H1V/11-3x.png" alt=""></div>
        <div class="flex flex-col justify-center items-center my-5 h-[5.6rem] text-white">
          <h1 class="text-base 2xl:text-3xl xl:text-2xl lg:text-xl md:text-lg sm:text-base">
            来探索美食
          </h1>
          <p class="text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs mt-[1.4rem]">
            品尝甜蜜，探索新意
          </p>
        </div>
      </div>
      <div class="w-1/4 h-[6.25rem] border border-black rounded-full flex justify-center  items-center  bg-white">
        <input type="text" placeholder="搜索菜品..." class="w-2/3 focus:outline-none " />
        <div><img src="https://i.postimg.cc/k5zP8c5w/2.png" alt="" class="w-[50px]"></div>
      </div>
      <div class="w-1/3  flex justify-center  items-center">
        <div class=" bg-white text-center  m-auto w-2/5 rounded-full">
          <div class="p-3" v-if=panduan>
            <span class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs"
              @click="$router.push('/logOn')">登录</span>
            <span class="mx-1">|</span>
            <span class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs "
              @click="$router.push('/regiSter')">注册</span>
          </div>
          <div class="p-3" v-if=!panduan>
            <span
              class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs">用户名:{{titlnames}}</span>
          </div>
>>>>>>> 30bc6c8bf8ab9ca385356b1647cbe58f04b0a486
        </div>
      </div>
      <div
        class="w-1/4 h-[6.25rem] border border-black rounded-full flex justify-center items-center bg-white"
      >
        <input
          type="text"
          placeholder="搜索菜品..."
          v-model="searchshop"
          @keydown.enter="search"
          class="w-2/3 focus:outline-none"
        />
        <div>
          <img
            src="https://i.postimg.cc/k5zP8c5w/2.png"
            alt=""
            class="w-[40px]"
            @click="search"
          />
        </div>
      </div>
      <div class="w-1/3 flex justify-center items-center">
        <div class="bg-white text-center m-auto w-2/5 rounded-full">
          <div class="p-3" v-if="panduan">
            <span
              class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs"
              @click="$router.push('/')"
              >登录</span
            >
            <span class="mx-1">|</span>
            <span
              class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs"
              @click="$router.push('/regiSter')"
              >注册</span
            >
          </div>
          <div class="p-3" v-if="!panduan" @click="touser">
            <span
              class="font-bold cursor-pointer text-xs 2xl:text-2xl xl:text-xl lg:text-lg md:text-base sm:text-xs"
              >用户名:{{ titlnames }}</span
            >
          </div>
        </div>
        <button
          class="bg-white rounded-xl px-2 py-1"
          v-if="!panduan"
          @click="tuuhu"
        >
          退出
        </button>
      </div>
    </div>
  </div>
</template>

<<<<<<< HEAD
<script setup>
import axios from "axios";
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
let username = ref(localStorage.getItem("userid"));
let panduan = ref(true);
let titlnames = ref("");
let searchshop = ref("");
onMounted(() => {
  axios
    .get(`http://1.14.126.98:8081/user/all?userId=${username.value}`)
    .then((res) => {
      panduan.value = false;
      titlnames.value = res.data.data.name;
    });
});
function touser() {
  router.push({
    name: "userMsg",
    query: {
      id: username.value,
    },
  });
}
function tuuhu() {
  router.push("/");
  localStorage.removeItem("userid");
  sessionStorage.removeItem('usertaken')
}
let shopdatail = ref([]);
let num=ref(1)
function search() {
  num.value++
  axios
    .get(
      `http://1.14.126.98:8081/product/search?keyword=${searchshop.value}&current=1&size=10`
    )
    .then((res) => {
      shopdatail.value = res.data.records;
      localStorage.setItem("search", JSON.stringify(shopdatail.value));
      sessionStorage.setItem('location',num.value)
      router.push("searchdetal");
    });
  searchshop.value = "";
}
</script>
=======
<script>
  import { useRoute, useRouter } from "vue-router"
  import axios from "axios"
  import { ref, onMounted } from "vue"
  export default {
    setup() {
      let username = ref(localStorage.getItem('userid'))
      let panduan=ref(true)
      let titlnames = ref("")
      onMounted(() => {
        axios.get(`http://1.14.126.98:8081/user/all?userId=${username.value}`)
          .then((res) => {
            panduan.value=false
            titlnames.value=res.data.data.name
          });
      })
      return {
        titlnames,
        panduan
      }
    }
  }
</script>
>>>>>>> 30bc6c8bf8ab9ca385356b1647cbe58f04b0a486
